package com.yimaxiaoerlang.module_signalling;

import com.yimaxiaoerlang.module_signalling.core.YMRTMLoginCallback;
import com.yimaxiaoerlang.module_signalling.core.YMRTMSendPeerMessageCallback;
import com.yimaxiaoerlang.module_signalling.core.YMRtmClientListener;
import com.yimaxiaoerlang.module_signalling.core.YMRtmManager;

public abstract class YMRTMClient {
    public static YMRTMClient registerAppKey(
                                             String appKey,
                                             String appSecret,
                                             YMRtmClientListener eventListener) {
        return YMRtmManager.createRtmInstance(appKey, appSecret, eventListener);
    }

    public static YMRTMClient registerAppKey(
            String appKey,
            String appSecret) {
        return YMRtmManager.createRtmInstance(appKey, appSecret, null);
    }

    //设置socket地址
    public abstract void setSocketAddress(String address);

    /**
     * 释放
     */
    public abstract void release();

    /**
     * 登录
     */
    public abstract void loginWithToken(
            String token,
            String userId,
            YMRTMLoginCallback resultCallback
    );

    /**
     * 退出
     */
    public abstract void logoutWithCompletion();


    /**
     * 创建房间对象
     */
    public abstract YMRTMChannel createChannelById(String channelId);

    /**
     * 发送消息
     */
    public abstract void sendMessage(
            String peerId,
            String message,
            YMRTMSendPeerMessageCallback callback
    );

    /**
     * 发送消息
     */
    public abstract void sendMessage(
            String peerId,
            String message
    );
}
